'use strict'


let data={}
class mylike{

  constructor (mdb) {
    this.mdb = mdb || null
  }
  async post(c){
      data.treeid=JSON.parse(c).userid
  }
  async get (c) {
    
    try{
      let sql=`select * from tree,user_focus where tree.treeid=user_focus.treeid and user_focus.uid=${data.userid}`
      let r=await this.mdb.query(sql)
      let result=r['rows']
      if(result.rowCount<=0){
        return ('failed register',400)
      }
      return result

    }catch(e){
      return ('failed',400)
    }
  }
  

}

module.exports = mylike
